home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / apel / emu-x20.el.z / emu-x20.el
Encoding:
Text File  |  1998-05-21  |  4.3 KB  |  144 lines

  1. ;;; emu-x20.el --- emu API implementation for XEmacs with mule
  2.  
  3. ;; Copyright (C) 1994,1995,1996,1997 MORIOKA Tomohiko
  4.  
  5. ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
  6. ;; Version: $Id: emu-x20.el,v 7.68 1997/11/04 07:41:28 morioka Exp $
  7. ;; Keywords: emulation, compatibility, Mule, XEmacs
  8.  
  9. ;; This file is part of XEmacs.
  10.  
  11. ;; XEmacs is free software; you can redistribute it and/or modify it
  12. ;; under the terms of the GNU General Public License as published by
  13. ;; the Free Software Foundation; either version 2, or (at your option)
  14. ;; any later version.
  15.  
  16. ;; XEmacs is distributed in the hope that it will be useful, but
  17. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  18. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  19. ;; General Public License for more details.
  20.  
  21. ;; You should have received a copy of the GNU General Public License
  22. ;; along with XEmacs; see the file COPYING.  If not, write to the Free
  23. ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  24. ;; 02111-1307, USA.
  25.  
  26. ;;; Commentary:
  27.  
  28. ;;    This module requires XEmacs 20.3-b5 or later with mule.
  29.  
  30. ;;; Code:
  31.  
  32. (require 'emu-xemacs)
  33. (require 'emu-20)
  34.  
  35.  
  36. ;;; @ MIME charset
  37. ;;;
  38.  
  39. (defun encode-mime-charset-region (start end charset)
  40.   "Encode the text between START and END as MIME CHARSET."
  41.   (let ((cs (mime-charset-to-coding-system charset)))
  42.     (if cs
  43.     (encode-coding-region start end cs)
  44.       )))
  45.  
  46. (defun decode-mime-charset-region (start end charset)
  47.   "Decode the text between START and END as MIME CHARSET."
  48.   (let ((cs (mime-charset-to-coding-system charset)))
  49.     (if cs
  50.     (decode-coding-region start end cs)
  51.       )))
  52.  
  53. (defun encode-mime-charset-string (string charset)
  54.   "Encode the STRING as MIME CHARSET."
  55.   (let ((cs (mime-charset-to-coding-system charset)))
  56.     (if cs
  57.     (encode-coding-string string cs)
  58.       string)))
  59.  
  60. (defun decode-mime-charset-string (string charset)
  61.   "Decode the STRING as MIME CHARSET."
  62.   (let ((cs (mime-charset-to-coding-system charset)))
  63.     (if cs
  64.     (decode-coding-string string cs)
  65.       string)))
  66.  
  67.  
  68. (defvar charsets-mime-charset-alist
  69.   '(((ascii)                        . us-ascii)
  70.     ((ascii latin-iso8859-1)                . iso-8859-1)
  71.     ((ascii latin-iso8859-2)                . iso-8859-2)
  72.     ((ascii latin-iso8859-3)                . iso-8859-3)
  73.     ((ascii latin-iso8859-4)                . iso-8859-4)
  74.     ((ascii cyrillic-iso8859-5)                . iso-8859-5)
  75. ;;; ((ascii cyrillic-iso8859-5)                . koi8-r)
  76.     ((ascii arabic-iso8859-6)                . iso-8859-6)
  77.     ((ascii greek-iso8859-7)                . iso-8859-7)
  78.     ((ascii hebrew-iso8859-8)                . iso-8859-8)
  79.     ((ascii latin-iso8859-9)                . iso-8859-9)
  80.     ((ascii latin-jisx0201
  81.         japanese-jisx0208-1978 japanese-jisx0208)    . iso-2022-jp)
  82.     ((ascii korean-ksc5601)                . euc-kr)
  83.     ((ascii chinese-gb2312)                . cn-gb-2312)
  84.     ((ascii chinese-big5-1 chinese-big5-2)        . cn-big5)
  85.     ((ascii latin-iso8859-1 greek-iso8859-7
  86.         latin-jisx0201 japanese-jisx0208-1978
  87.         chinese-gb2312 japanese-jisx0208
  88.         korean-ksc5601 japanese-jisx0212)        . iso-2022-jp-2)
  89.     ((ascii latin-iso8859-1 greek-iso8859-7
  90.         latin-jisx0201 japanese-jisx0208-1978
  91.         chinese-gb2312 japanese-jisx0208
  92.         korean-ksc5601 japanese-jisx0212
  93.         chinese-cns11643-1 chinese-cns11643-2)    . iso-2022-int-1)
  94.     ((ascii latin-iso8859-1 latin-iso8859-2
  95.         cyrillic-iso8859-5 greek-iso8859-7
  96.         latin-jisx0201 japanese-jisx0208-1978
  97.         chinese-gb2312 japanese-jisx0208
  98.         korean-ksc5601 japanese-jisx0212
  99.         chinese-cns11643-1 chinese-cns11643-2
  100.         chinese-cns11643-3 chinese-cns11643-4
  101.         chinese-cns11643-5 chinese-cns11643-6
  102.         chinese-cns11643-7)                . iso-2022-int-1)
  103.     ))
  104.  
  105. (defun detect-mime-charset-region (start end)
  106.   "Return MIME charset for region between START and END."
  107.   (charsets-to-mime-charset (charsets-in-region start end)))
  108.  
  109.  
  110. ;;; @ character
  111. ;;;
  112.  
  113. ;;; @@ Mule emulating aliases
  114. ;;;
  115. ;;; You should not use them.
  116.  
  117. (defalias 'char-leading-char 'char-charset)
  118.  
  119. (defun char-category (character)
  120.   "Return string of category mnemonics for CHAR in TABLE.
  121. CHAR can be any multilingual character
  122. TABLE defaults to the current buffer's category table."
  123.   (mapconcat (lambda (chr)
  124.            (char-to-string (int-char chr))
  125.            )
  126.          (char-category-list character)
  127.          ""))
  128.  
  129.  
  130. ;;; @ string
  131. ;;;
  132.  
  133. (defun string-to-int-list (str)
  134.   (mapcar #'char-int str)
  135.   )
  136.  
  137.  
  138. ;;; @ end
  139. ;;;
  140.  
  141. (provide 'emu-x20)
  142.  
  143. ;;; emu-x20.el ends here
  144.